#x,n,bitNum输入变量
library(moments)
thisN <- ceiling(sqrt(length(x)))
thisBitNum <- 6
if(exists("n")&&!is.null(n) && n > 0) {
  thisN <<- n
}
if (exists("bitNum")&&!is.null(bitNum) && bitNum >= 0) {
  thisBitNum <- bitNum
}

#普通值
avgValue <- mean(x)
print(avgValue)
minValue <- min(x)
maxValue <- max(x)
stdevValue <- sd(x)
rangeValue <- max(x) - min(x)
kurtosisValue <- kurtosis(x)
skewnessValue <- skewness(x)

divideValue <- x
barValue <- x

cl <- c(-3, -2, -1, 0, 1, 2, 3)
CL <- avgValue + cl * stdevValue

#正态分布图
x1 <- c(x, CL[1], CL[7])
curveXValue <- seq(min(x1),max(x1),length=100)
curveYValue <- dnorm(curveXValue, mean=avgValue,sd=stdevValue)

#移动极差
m <- length(x)
moveClaData <- abs(c(x[2:m], x[1]) - x[1:m])

#直方图
divideValue <- seq(minValue, maxValue, by=(rangeValue)/thisN)
#barValue <- c(0,as.data.frame(table(cut(x, divideValue, include.lowest=T)))[,2])
barValue <- as.data.frame(table(cut(x, divideValue, include.lowest=T)))[,2]

#curveXValue <- round(curveXValue, thisBitNum)
#curveYValue <- round(curveYValue, thisBitNum)
#divideValue <- round(divideValue, thisBitNum)
#barValue<-round(barValue, thisBitNum)
#moveClaData <- round(moveClaData, thisBitNum)
#CL <- round(CL, thisBitNum)


